package com.example.taobaounion.utils;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

import com.example.taobaounion.base.BaseApplication;
import com.example.taobaounion.manager.PresenterManager;
import com.example.taobaounion.model.domain.IBaseInfo;
import com.example.taobaounion.presenter.impl.TicketPresenter;
import com.example.taobaounion.view.activity.impl.TicketActivity;

public class TicketUtil {

    public static void toTicketPage(Context context, IBaseInfo baseInfo) {
        String title = baseInfo.getTitle();
        String click_url = baseInfo.getUrl();

        String pict_url = baseInfo.getCover();

        if (TextUtils.isEmpty(click_url)) {
            click_url = baseInfo.getUrl();
        }


        TicketPresenter ticketPresenter = PresenterManager.getInstance().getTicketPresenter();

        ticketPresenter.getTicket(title, click_url, pict_url);

        context.startActivity(new Intent(BaseApplication.getAppContext(), TicketActivity.class));

    }
}
